home *** CD-ROM | disk | FTP | other *** search
- unit Unit5_2;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls;
-
- type
- TForm2 = class(TForm)
- Bou1: TShape;
- Shape3: TShape;
- Shape1: TShape;
- Shape2: TShape;
- Shape4: TShape;
- Shape5: TShape;
- Jun1: TLabel;
- Maru1: TShape;
- Label1: TLabel;
- Tokuten: TLabel;
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private 宣言 }
- public
- { Public 宣言 }
- procedure Push(Position : Integer);
- procedure Seikai(UpHeight : Integer);
- procedure HuSeikai(UpHeight : Integer);
- procedure Clear;
- end;
-
- var
- Form2: TForm2;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm2.FormCreate(Sender: TObject);
- begin
- {得点の表示を0にする}
- Tokuten.Caption := '0';
- end;
-
- procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- Action := caFree;
- end;
-
- procedure TForm2.Push(Position : Integer);
- Begin
- {1番ならバックの色をclLimeに}
- If Position = 1 Then
- Color := clLime;
- Maru1.Visible := True;
- Bou1.Visible := True;
- Jun1.Caption := IntToStr(Position);
- End;
-
- procedure TForm2.Seikai(UpHeight : Integer);
- var
- i : Integer;
- f : Real;
- t : LongInt;
- begin
- {10問正解している場合はパス}
- If Tokuten.Caption = '10000' Then
- Exit;
-
- {移動する量の10分の1}
- f := UpHeight / 10;
- For i := 1 To 10 Do
- Begin
- Top := Top - Round(f);
- t := GetTickCount + 50;
- Repeat
- Application.ProcessMessages;
- Until t < GetTickCount;
- End;
-
- Color := clBtnFace;
-
- Tokuten.Caption := IntToStr(StrToInt(Tokuten.Caption) + 1000);
-
- If Tokuten.Caption = '10000' Then
- ShowMessage('おめでとうございます!!' + #10 + Caption + 'さんの優勝です!!');
-
- End;
-
- procedure TForm2.HuSeikai(UpHeight : Integer);
- var
- i : Integer;
- f : Real;
- t : LongInt;
- begin
- f := UpHeight / 10;
-
- While StrToInt(Tokuten.Caption) > 0 Do
- Begin
- t := GetTickCount + 500;
- Repeat
- Application.ProcessMessages;
- Until t < GetTickCount;
-
- For i := 1 To 10 Do
- Begin
- Top := Top + Round(f);
- t := GetTickCount + 50;
- Repeat
- Application.ProcessMessages;
- Until t < GetTickCount;
- End;
-
- Tokuten.Caption := IntToStr(StrToInt(Tokuten.Caption) - 1000);
- End;
- End;
-
- procedure TForm2.Clear;
- begin
- Color := clBtnFace;
- Maru1.Visible := False;
- Bou1.Visible := False;
- Jun1.Caption := '';
- end;
-
- end.
-